package net.xy.utils;

/**
 * @author: NMY
 * @Date: 2021/7/13
 * @Time: 17:14
 */
public class Tools {

    /**
     * 格式化路径，去掉前后的正反斜杠，并且反斜杠变成正斜杠
     *
     * @param path
     * @return
     */
    public static String trimPath(String path) {
        if (path == null || path.trim().equals("")) {
            return "";
        }
        path = path.replaceAll("\\\\", "/").replaceAll("^/*|/*$", "");
        return "".equals(path) ? "" : path + "/";
    }
}
